package vip.liux.backend.infrastructure.message;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.sql.init.DatabaseInitializationMode;
import org.springframework.transaction.annotation.Isolation;

@ConfigurationProperties(prefix = "spring.message.jdbc")
public class MessageProperties {
    private static final String DEFAULT_SCHEMA_LOCATION = "classpath:vip/liux/"
            + "backend/infrastructure/message/schema-@@platform@@.sql";

    /**
     * Transaction isolation level to use when creating job meta-data for new jobs.
     */
    private Isolation isolationLevelForCreate;

    /**
     * Path to the SQL file to use to initialize the database schema.
     */
    private String schema = DEFAULT_SCHEMA_LOCATION;

    /**
     * Platform to use in initialization scripts if the @@platform@@ placeholder is
     * used. Auto-detected by default.
     */
    private String platform;

    /**
     * Table prefix for all the batch meta-data tables.
     */
    private String tablePrefix;

    /**
     * Database schema initialization mode.
     */
    private DatabaseInitializationMode initializeSchema = DatabaseInitializationMode.EMBEDDED;

    public Isolation getIsolationLevelForCreate() {
        return this.isolationLevelForCreate;
    }

    public void setIsolationLevelForCreate(Isolation isolationLevelForCreate) {
        this.isolationLevelForCreate = isolationLevelForCreate;
    }

    public String getSchema() {
        return this.schema;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

    public String getPlatform() {
        return this.platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public String getTablePrefix() {
        return this.tablePrefix;
    }

    public void setTablePrefix(String tablePrefix) {
        this.tablePrefix = tablePrefix;
    }

    public DatabaseInitializationMode getInitializeSchema() {
        return this.initializeSchema;
    }

    public void setInitializeSchema(DatabaseInitializationMode initializeSchema) {
        this.initializeSchema = initializeSchema;
    }
}
